#include <stdio.h>

int cow1(int year)
{
    if (year <= 3)
        return 1;
    return cow1(year - 1) + cow1(year - 3);
}

int cow2(int year)
{
    int i;

    int a[4] = {1,0,0,0};

    for (i = 1; i < year; i++) {
        a[3] += a[2];
        a[2] = a[1];
        a[1] = a[0];
        a[0] = a[3];
    }

    return a[0]+a[1]+a[2]+a[3];
}

int main(int argc, char const* argv[])
{
    int i, year;

    if (argc != 2)
    {
        printf("usage: %s years (years > 0)\n", argv[0]);
        return 0;
    }

    year = atoi(argv[1]);
    if (year <= 0)
    {
        printf("usage: %s years (years > 0)\n", argv[0]);
        return 0;
    }

    for (i = 1; i <= year; i ++)
        printf("At year %d, the count of cow is %d\n", i, cow2(i));

    return 0;
}
